<?php
$email = $_POST['email'];

$con = mysqli_connect('localhost','root','','cs2102');
	if(mysqli_connect_errno($con))
	{
		echo "error";
	}
	else
	{
		$query = "SELECT * FROM orders where email = \"$email\"";
		$index =0;
		$result =  mysqli_query($con, $query);
		
		if($result){
			$content = array();
			
			while($row = mysqli_fetch_array($result)){
				$content[$index] = $row;
				$index++;
			}

			echo json_encode($content);
		}else{
			echo "error";
		}
	}
	
	mysqli_close($con);
?>